Original Data

Row

A look at the data

# A tibble: 6 x 24
  Group    ID Genotype LV_Vol_s LV_Vol_d    EF    FS Dia_s Dia_d    CO
  <chr> <dbl> <chr>       <dbl>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 June   2408 Wild_Ty…     24.9     64.4  61.3  32.3  2.61  3.86  22.2
2 June   2409 Wild_Ty…     27.5     77.9  64.7  35    2.72  4.18  26  
3 June   2406 Mutant       59.3    105.   43.7  21.6  3.73  4.76  25  
4 June   2407 Wild_Ty…     23.9     67.6  64.7  34.8  2.57  3.94  23.2
5 June   2420 Wild_Ty…     25.4     63.4  60    31.3  2.64  3.83  19  
6 June   2418 Mutant       25.4     68.2  62.8  33.4  2.63  3.96  20.8
# … with 14 more variables: HR <dbl>, LVAW_d <dbl>, LVAW_s <dbl>,
#   LVPW_d <dbl>, LVPW_s <dbl>, LVOT_mean_grad <dbl>, LVOT_mean_vel <dbl>,
#   LVOT_Peak_grad <dbl>, LVOT_Peak_vel <dbl>, Aor_sys <dbl>,
#   Aor_dia <dbl>, Aor_FS <dbl>, brach <dbl>, PWV <dbl>
    Group                 ID         Genotype            LV_Vol_s    
 Length:42          Min.   :2247   Length:42          Min.   :16.00  
 Class :character   1st Qu.:2408   Class :character   1st Qu.:25.32  
 Mode  :character   Median :2420   Mode  :character   Median :30.35  
                    Mean   :2420                      Mean   :33.96  
                    3rd Qu.:2488                      3rd Qu.:42.38  
                    Max.   :2493                      Max.   :61.00  
                                                      NA's   :2      
    LV_Vol_d            EF              FS            Dia_s      
 Min.   : 45.20   Min.   :24.60   Min.   :11.20   Min.   :2.189  
 1st Qu.: 67.35   1st Qu.:51.55   1st Qu.:26.32   1st Qu.:2.629  
 Median : 77.45   Median :60.45   Median :32.00   Median :2.830  
 Mean   : 77.70   Mean   :57.32   Mean   :30.11   Mean   :2.921  
 3rd Qu.: 83.90   3rd Qu.:63.08   3rd Qu.:33.77   3rd Qu.:3.244  
 Max.   :105.40   Max.   :74.00   Max.   :42.00   Max.   :3.775  
 NA's   :2        NA's   :2       NA's   :2       NA's   :2      
     Dia_d             CO              HR            LVAW_d      
 Min.   :3.334   Min.   : 9.20   Min.   :416.0   Min.   :0.8280  
 1st Qu.:3.935   1st Qu.:20.00   1st Qu.:478.5   1st Qu.:0.8750  
 Median :4.175   Median :22.10   Median :518.0   Median :0.9310  
 Mean   :4.166   Mean   :22.62   Mean   :516.9   Mean   :0.9631  
 3rd Qu.:4.317   3rd Qu.:25.00   3rd Qu.:554.5   3rd Qu.:1.0243  
 Max.   :4.759   Max.   :33.00   Max.   :616.0   Max.   :1.2800  
 NA's   :2       NA's   :2       NA's   :2       NA's   :2       
     LVAW_s          LVPW_d           LVPW_s      LVOT_mean_grad  
 Min.   :1.350   Min.   :0.8000   Min.   :1.270   Min.   : 1.200  
 1st Qu.:1.380   1st Qu.:0.8552   1st Qu.:1.312   1st Qu.: 2.175  
 Median :1.406   Median :0.9260   Median :1.375   Median : 2.650  
 Mean   :1.435   Mean   :0.9519   Mean   :1.376   Mean   : 4.048  
 3rd Qu.:1.448   3rd Qu.:1.0083   3rd Qu.:1.400   3rd Qu.: 3.550  
 Max.   :1.706   Max.   :1.2830   Max.   :1.622   Max.   :17.700  
 NA's   :2       NA's   :2        NA's   :2       NA's   :2       
 LVOT_mean_vel    LVOT_Peak_grad   LVOT_Peak_vel     Aor_sys     
 Min.   : 555.0   Min.   : 2.800   Min.   : 839   Min.   :1.440  
 1st Qu.: 743.5   1st Qu.: 5.475   1st Qu.:1169   1st Qu.:1.678  
 Median : 818.0   Median : 7.050   Median :1326   Median :1.885  
 Mean   : 941.2   Mean   : 9.863   Mean   :1477   Mean   :1.942  
 3rd Qu.: 943.2   3rd Qu.: 8.350   3rd Qu.:1446   3rd Qu.:2.083  
 Max.   :2103.0   Max.   :36.000   Max.   :2995   Max.   :3.200  
 NA's   :2        NA's   :2        NA's   :2      NA's   :5      
    Aor_dia          Aor_FS           brach             PWV       
 Min.   :1.270   Min.   :0.0500   Min.   :0.6570   Min.   :2.800  
 1st Qu.:1.479   1st Qu.:0.0745   1st Qu.:0.7847   1st Qu.:3.590  
 Median :1.620   Median :0.1165   Median :0.8945   Median :3.880  
 Mean   :1.713   Mean   :0.1092   Mean   :0.9248   Mean   :4.129  
 3rd Qu.:1.889   3rd Qu.:0.1398   3rd Qu.:0.9832   3rd Qu.:4.320  
 Max.   :3.031   Max.   :0.1790   Max.   :1.6310   Max.   :8.400  
 NA's   :6       NA's   :6        NA's   :6        NA's   :25     
 [1] "Group"          "ID"             "Genotype"       "LV_Vol_s"      
 [5] "LV_Vol_d"       "EF"             "FS"             "Dia_s"         
 [9] "Dia_d"          "CO"             "HR"             "LVAW_d"        
[13] "LVAW_s"         "LVPW_d"         "LVPW_s"         "LVOT_mean_grad"
[17] "LVOT_mean_vel"  "LVOT_Peak_grad" "LVOT_Peak_vel"  "Aor_sys"       
[21] "Aor_dia"        "Aor_FS"         "brach"          "PWV"           

Column

Running some statistics

$LV_Vol_s

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 5.9496, df = 38, p-value = 6.676e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 10.96673 22.27888
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               42.68947                26.06667 


$LV_Vol_d

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 3.8686, df = 38, p-value = 0.0004162
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  6.819928 21.792603
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               85.21579                70.90952 


$EF

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = -6.0947, df = 38, p-value = 4.221e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -17.665947  -8.856358
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               50.35789                63.61905 


$FS

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = -6.3226, df = 38, p-value = 2.057e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -11.209337  -5.772117
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               25.64737                34.13810 


$Dia_s

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 6.1376, df = 38, p-value = 3.686e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.3919792 0.7778153
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               3.228421                2.643524 


$Dia_d

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 3.8211, df = 38, p-value = 0.0004782
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.1513222 0.4923119
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               4.334579                4.012762 


$CO

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = -0.84613, df = 38, p-value = 0.4028
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -3.902695  1.601943
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               22.02105                23.17143 


$HR

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 0.18047, df = 38, p-value = 0.8577
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -29.06393  34.75315
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               518.3684                515.5238 


$LVAW_d

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 5.6284, df = 38, p-value = 1.841e-06
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.09635995 0.20461248
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               1.042105                0.891619 


$LVAW_s

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 3.1531, df = 38, p-value = 0.00315
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.02709746 0.12429603
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               1.474316                1.398619 


$LVPW_d

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 4.6126, df = 38, p-value = 4.418e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.07852254 0.20135716
sample estimates:
   mean in group Mutant mean in group Wild_Type 
              1.0253684               0.8854286 


$LVPW_s

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 2.6399, df = 38, p-value = 0.01196
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.01299953 0.09850423
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               1.404895                1.349143 


$LVOT_mean_grad

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 3.4472, df = 38, p-value = 0.001398
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 1.477108 5.680286
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               5.926316                2.347619 


$LVOT_mean_vel

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 3.94, df = 38, p-value = 0.0003372
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 186.0828 579.3759
sample estimates:
   mean in group Mutant mean in group Wild_Type 
              1142.1579                759.4286 


$LVOT_Peak_grad

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 3.8084, df = 38, p-value = 0.0004963
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  4.161416 13.605502
sample estimates:
   mean in group Mutant mean in group Wild_Type 
              14.526316                5.642857 


$LVOT_Peak_vel

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 4.4382, df = 38, p-value = 7.541e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 339.5570 909.1046
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               1804.474                1180.143 


$Aor_sys

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 5.9821, df = 35, p-value = 8.152e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.3407812 0.6908971
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               2.192895                1.677056 


$Aor_dia

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 6.2424, df = 34, p-value = 4.18e-07
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.3419442 0.6720558
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               1.966056                1.459056 


$Aor_FS

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = -4.1162, df = 34, p-value = 0.0002318
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -0.06323398 -0.02143268
sample estimates:
   mean in group Mutant mean in group Wild_Type 
              0.0880000               0.1303333 


$brach

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 5.4092, df = 34, p-value = 5.052e-06
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.1851729 0.4080494
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               1.073111                0.776500 


$PWV

    Two Sample t-test

data:  x by EchoC_data$Genotype
t = 2.5485, df = 15, p-value = 0.02226
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.220428 2.473461
sample estimates:
   mean in group Mutant mean in group Wild_Type 
               4.842500                3.495556 

Visualizations

Row

Early violin plots

Row

Poster violin plots

Row

Tidied paired violin plots

Interactive Plots

Column

Using plotly

About

Row

Dashboard made by Jacob Noeker:

  • Made for Data Visualization in R
  • Thank you to Abhijit Dasgupta
---
title: "Data Viz Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    source_code: embed
    
---

```{r setup, include=FALSE}
library(tidyverse)
library(readxl)
library(ggplot2)
library(plotly)
knitr::opts_chunk$set(message = FALSE)
```

Original Data {vertical_layout=scroll data-icon="fa-archive"}
===================================== 

Row {data-height=10000}
------------------------------------------------------------------------------

### A look at the data

```{r raw data}
EchoC_data <- read_excel("Pfeifer Echo Edit for R.xlsx", sheet = "Echo_for_R")
head(EchoC_data)
summary(EchoC_data)
names(EchoC_data)

```

Column {data-height=10000}
------------------------------------------------------------------------------

### Running some statistics

```{r stats}

stats_1<-lapply(EchoC_data[,4:24], function(x) t.test(x ~ EchoC_data$Genotype, var.equal = TRUE))
stats_1

```


Visualizations {data-orientation=columns data-icon="fa-chart-bar"}
===================================== 
Row {.tabset data-height=400}
------------------------------------------------------------------------------

### Early violin plots 

```{r Early Data}
LV_Sys_Vol_Sept <- ggplot(EchoC_data, aes(x = Genotype, y = LV_Vol_s)) + geom_violin() + theme_bw() + 
  ylab("Left Ventricular Systolic Volume (uL)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant"), label = c("Wild Type", "Mutant")) +
  ggtitle("September 2018 Systolic Volume Variation") + 
  theme(plot.title = element_text(hjust = 0.5)) +
  stat_summary(fun.y = mean, geom="point", shape = 18, size  = 3) + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue")
LV_Sys_Vol_Sept

LV_Diameter_Sept <- ggplot(EchoC_data, aes(x = Genotype, y = Dia_s)) + geom_violin() + theme_bw() + 
  ylab("Left Ventricular Diameter (mm)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant"), label = c("Wild Type", "Mutant")) +
  ggtitle("September 2018 Diameter Variation During Systole") + 
  theme(plot.title = element_text(hjust = 0.5)) +
  stat_summary(fun.y = mean, geom="point", shape = 18, size  = 3) + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue")
LV_Diameter_Sept
```

Row {.tabset data-height=400}
------------------------------------------------------------------------------

### Poster violin plots 

```{r poster graphs}

jn_theme <- function(){
  theme_bw() +
    theme(axis.text = element_text(size = 14, color = "Black"),
          axis.title = element_text(size = 16),
          panel.grid.minor = element_blank(),
          strip.text = element_text(size=14),
          strip.background = element_blank(),
          plot.title = element_text(size = 20, hjust = 0.5),
          panel.grid.major.x = element_blank())
}


LV_Sys_Vol_15 <- ggplot(data = EchoC_data[EchoC_data$Group == "September",], aes(x = Genotype, y = LV_Vol_s)) + 
  geom_violin(scale = "area", adjust = 1, aes(color = Genotype), show.legend = FALSE) + 
  scale_color_manual(values = c("Wild_Type"="Black", "Mutant"="Red")) +
  geom_point(size = 0.5, height = 0, width = 0.05) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Left Ventricular Systolic Volume (uL)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  stat_summary(fun.y = mean, geom = "point", shape = 5, size  = 3, color = "#9A2617") + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue") +
  jn_theme() +
  theme(axis.title.x = element_blank())
LV_Sys_Vol_15

#Dont need this for poster
LV_Diam_systole_15 <- ggplot(data = EchoC_data[EchoC_data$Group == "September",], aes(x = Genotype, y = Dia_s)) + 
  geom_violin(scale = "area", adjust = 1, aes(color = Genotype), show.legend = FALSE) + 
  scale_color_manual(values = c("Wild_Type"="Black", "Mutant"="Red")) +
  geom_point(size = 0.5, height = 0, width = 0.05) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Left Ventricular Diameter (mm)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  stat_summary(fun.y = mean, geom = "point", shape = 5, size  = 3, color = "#9A2617") + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue") +
  jn_theme() +
  theme(axis.title.x = element_blank())
LV_Diam_systole_15


LVAW_dia_15 <- ggplot(data = EchoC_data[EchoC_data$Group == "September",], aes(x = Genotype, y = LVAW_d)) + 
  geom_violin(scale = "area", adjust = 1, aes(color = Genotype), show.legend = FALSE) + 
  scale_color_manual(values = c("Wild_Type"="Black", "Mutant"="Red")) +
  geom_point(size = 0.5, height = 0, width = 0.05) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Left Ventricular Anterior Wall Diameter (mm)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  stat_summary(fun.y = mean, geom = "point", shape = 5, size  = 3, color = "#9A2617") + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue") +
  jn_theme() +
  theme(axis.title.x = element_blank())
LVAW_dia_15

Ejection_fraction_15 <- ggplot(data = EchoC_data[EchoC_data$Group == "September",], aes(x = Genotype, y = EF)) + 
  geom_violin(scale = "area", adjust = 1, aes(color = Genotype), show.legend = FALSE) + 
  scale_color_manual(values = c("Wild_Type"="Black", "Mutant"="Red")) +
  geom_point(size = 0.5, height = 0, width = 0.05) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Ejection Fraction (%)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  stat_summary(fun.y = mean, geom = "point", shape = 5, size  = 3, color = "#9A2617") + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue") +
  jn_theme() +
  theme(axis.title.x = element_blank())
Ejection_fraction_15


LVOT_Mean_grad_15 <- ggplot(data = EchoC_data[EchoC_data$Group == "September",], aes(x = Genotype, y = LVOT_mean_grad)) + 
  geom_violin(scale = "area", adjust = 1, aes(color = Genotype), show.legend = FALSE) + 
  scale_color_manual(values = c("Wild_Type"="Black", "Mutant"="Red")) +
  geom_point(size = 0.5, height = 0, width = 0.05) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Mean Gradient (mmHg)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  stat_summary(fun.y = mean, geom = "point", shape = 5, size  = 3, color = "#9A2617") + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue") +
  jn_theme() +
  theme(axis.title.x = element_blank())
LVOT_Mean_grad_15

Aorta_sys_15<- ggplot(data = EchoC_data[EchoC_data$Group == "September",], aes(x = Genotype, y = Aor_sys)) + 
  geom_violin(scale = "area", adjust = 1, aes(color = Genotype), show.legend = FALSE) + 
  scale_color_manual(values = c("Wild_Type"="Black", "Mutant"="Red")) +
  geom_point(size = 0.5, height = 0, width = 0.05) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Aorta Diameter (mm)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  stat_summary(fun.y = mean, geom = "point", shape = 5, size  = 3, color = "#9A2617") + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue") +
  jn_theme() +
  theme(axis.title.x = element_blank())
Aorta_sys_15
```


Row {.tabset data-height=400}
------------------------------------------------------------------------------

### Tidied paired violin plots 
```{r plots}

jn_theme <- function(){
  theme_bw() +
    theme(axis.text = element_text(size = 14, color = "Black"),
          axis.title = element_text(size = 16),
          panel.grid.minor = element_blank(),
          strip.text = element_text(size=14),
          strip.background = element_blank(),
          plot.title = element_text(size = 20, hjust = 0.5),
          panel.grid.major.x = element_blank())
}


LV_EF <- ggplot(EchoC_data, aes(x = Genotype, y = EF, fill = Group)) + 
  geom_violin(scale = "area", adjust = 1) + 
  scale_fill_manual(values=c("#999999", "#D4AF37", "#56B4E9")) +
  theme_bw() + 
  geom_point(position=position_dodge(width = 0.9), aes(group = Group), size = .5, height = 0, width = 0.05, show.legend = FALSE) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Ejection Fraction %") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  ggtitle("Ejection Fraction Variation") + 
  theme(plot.title = element_text(hjust = 0.5)) +
  stat_summary(fun.y = mean, geom="point", shape = 18, size  = 3, color = "red", position = position_dodge(width = 0.9), show.legend = FALSE) + 
  stat_summary(fun.y=median,  geom = "point", shape = 3, size = 3, color = "blue", position = position_dodge(width = 0.9), show.legend = FALSE) +
  jn_theme()
LV_EF


LVOT_Mean_grad <- ggplot(EchoC_data, aes(x = Genotype, y = LVOT_mean_grad, fill = Group)) + 
  geom_violin(scale = "area", adjust = 1) + 
  scale_fill_manual(values=c("#999999", "#D4AF37", "#56B4E9")) +
  theme_bw() + 
  geom_point(position=position_dodge(width = 0.9), aes(group = Group), size = .5, height = 0, width = 0.05, show.legend = FALSE) + 
  ylab("Left Ventricular Outflow Tract Mean Gradient") + #UNITS???
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  ggtitle("Left Ventricular Outflow Tract Mean Gradient Variation") + 
  theme(plot.title = element_text(hjust = 0.5)) +
  stat_summary(fun.y = mean, geom="point", shape = 18, size  = 3, color = "red", position = position_dodge(width = 0.9), show.legend = FALSE) + 
  stat_summary(fun.y=median,  geom = "point", shape = 3, size = 3, color = "blue", position = position_dodge(width = 0.9), show.legend = FALSE) +
  jn_theme()
LVOT_Mean_grad


Aorta_sys <- ggplot(EchoC_data, aes(x = Genotype, y = Aor_sys, fill = Group)) + 
  geom_violin(scale = "area", adjust = 1) + 
  scale_fill_manual(values=c("#999999", "#D4AF37", "#56B4E9")) +
  theme_bw() + 
  geom_point(position=position_dodge(width = 0.9), aes(group = Group), size = .5, height = 0, width = 0.05, show.legend = FALSE) + 
  ylab("Aorta Diameter (mm)") + #UNITS???
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  ggtitle("Variations in Aortic Diameter in Systole") + 
  theme(plot.title = element_text(hjust = 0.5)) +
  stat_summary(fun.y = mean, geom="point", shape = 18, size  = 3, color = "red", position = position_dodge(width = 0.9), show.legend = FALSE) + 
  stat_summary(fun.y=median,  geom = "point", shape = 3, size = 3, color = "blue", position = position_dodge(width = 0.9), show.legend = FALSE) +
  jn_theme()
Aorta_sys

```





Interactive Plots {data-orientation=columns data-icon="fa-eye"}
===================================== 

Column {data-width=500}
------------------------------------------------------------------------------

### Using plotly

```{r interactive}

jn_theme <- function(){
  theme_bw() +
    theme(axis.text = element_text(size = 14, color = "Black"),
          axis.title = element_text(size = 16),
          panel.grid.minor = element_blank(),
          strip.text = element_text(size=14),
          strip.background = element_blank(),
          plot.title = element_text(size = 20, hjust = 0.5),
          panel.grid.major.x = element_blank())
}


LV_Sys_Vol <- ggplot(EchoC_data, aes(x = Genotype, y = LV_Vol_s, fill = Group, label = ID)) + 
  geom_violin() + 
  xlim(0, 20) +
  scale_fill_manual(values=c("#999999", "#D4AF37", "#56B4E9")) +
  geom_point(position=position_dodge(width = .9), aes(group = Group), size = .5, height = 0, width = 0.05, show.legend = FALSE) + #can use geom_jitter to introduce a small amount of random variation to the location of each point to handle overplott
  ylab("Left Ventricular Systolic Volume (μL)") + 
  scale_x_discrete(limits = c("Wild_Type", "Mutant")) + 
  ggtitle("Systolic Volume Variation") + 
  stat_summary(fun.y = mean, geom = "point", shape = 18, size  = 3, color = "red", position = position_dodge(width = 0.9), show.legend = FALSE) + 
  stat_summary(fun.y = median,  geom = "point", shape = 3, size = 3, color = "blue", position = position_dodge(width = 0.9), show.legend = FALSE) +
  jn_theme()

LV_Sys_Vol




#Messing around:
library(plotly)
ggplotly(LV_Sys_Vol, tooltip = c("ID", "LV_Vol_s"))%>%layout(violinmode = 'group', violingap = 1, violingroupgap = 1)

```


About {data-orientation=rows data-icon="fa-comment-alt"}
===================================== 

Row {data-height=1000}
------------------------------------------------------------------------------

Dashboard made by Jacob Noeker:

* Made for Data Visualization in R
* Thank you to Abhijit Dasgupta